Creating shooting arrow class [on hold]
Posted
by
I.Hristov
on Game Development
See other posts from Game Development
or by I.Hristov
Published on 2013-10-22T19:51:59Z
Indexed on
2013/10/22
22:03 UTC
Read the original article
Hit count: 249
game-mechanics
OK I am trying to write an XNA game with one controllable by the player entity, while the rest are bots (enemy and friendly) wondering around and... shooting each other from range. Now the shooting I suppose should be done with a separate class Arrow (for example).
The resulting object would be the arrow appearing on screen moving from shooting entity to target entity. When target is reached arrow is no longer active, probably removed from the list.
I plan to make a class with fields:
Vector2 shootingEntity;
Vector2 targetEntity;
float arrowSpeed;
float arrowAttackSpeed;
int damageDone;
bool isActive;
Then when enemy entities get closer than a int rangeToShoot
(which each entity will have as a field/prop) I plan to make a list of arrows emerging from each entity and going to the closest opposite one.
I wonder if that logic will enable me later to make possible many entities to be able to shoot independently at different enemy entities at the same time. I know the question is broad but it would be wise to ask if the foundations of the idea are correct.
© Game Development or respective owner